import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false


App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp, reactive } from 'vue'
import mqtt from "mqtt";
export function createApp() {
  const app = createSSRApp(App)
  
	// 创建一个响应式的数据对象
    const sharedState = reactive({
      isConnected: false,
	  client: null,
	  imageSrc: null,
	  options: {
	  	clientId: "k1yxa0Zedsn.vedio2|securemode=2,signmethod=hmacsha256,timestamp=1744028106471|",
	  	username: "vedio2&k1yxa0Zedsn",
	  	password: "be9ae002088947591be481c4d1a83b471ce110aef467ea2f8ab4e1dca81438fc",
	  	protocolVersion: 4,
	  	clean: true,
	  	reconnectPeriod: 1000,
	  	connectTimeout: 30 * 1000,
	  	qos: 0,
	  	keepalive: 60
	  },
	  aliyunInfo: {
	  	productKey: "k1yxa0Zedsn",
	  	deviceName: "vedio2",
	  	deviceSecret: "b54300d2bae4269cd9e07c4f0561fc48",
	  	regionId: "cn-shanghai",
	  	pubTopic: "/sys/k1yxa0Zedsn/vedio2/thing/event/property/post",
	  	subTopic: "/sys/k1yxa0Zedsn/vedio2/thing/service/property/set",
	  },
	  deviceStates: { // 新增设备状态存储
	     fan: false,
	     Ultraviolet: false,
	     Servos: false,
	     humidifier: false,
	     ai: false
	    }
    })
    
    // 提供响应式对象，供子组件注入使用
    app.provide('sharedState', sharedState)
  
  return {
    app
  }
}
// #endif